
** PERSONALITY MEASURES **



	// Neuroticism

		foreach p in b e {

		* Variables
			summ nrtc_sad_`p' nrtc_worry_`p' nrtc_threaten_`p' nrtc_offend_`p' nrtc_stress_`p' nrtc_disturb_`p' nrtc_relax_`p' nrtc_bother_`p'

		* Positive questions: Change to 0-Really Disagree 1-Disagree 2-Agree 3-Really Agree
			foreach var in nrtc_sad nrtc_worry nrtc_threaten nrtc_offend nrtc_stress nrtc_disturb {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'*-1+4
				la var `var'_resc_`p' "`lab' (Rescaled)"
			}

		* Negative question : Change to 0-Really Agree 1-Agree 2-Disagree 3-Really Disagree
			foreach var in nrtc_relax nrtc_bother {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'-1
				la var `var'_resc_`p' "`lab'"
			}

		* Analyze responses
			summ nrtc_sad_resc_`p' nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p' nrtc_disturb_resc_`p' nrtc_relax_resc_`p' nrtc_bother_resc_`p'
			pwcorr nrtc_sad_resc_`p' nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p' nrtc_disturb_resc_`p' nrtc_relax_resc_`p' nrtc_bother_resc_`p'
			factor nrtc_sad_resc_`p' nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p' nrtc_disturb_resc_`p' nrtc_relax_resc_`p' nrtc_bother_resc_`p'

		* Generate declared neurotism index
			egen neurotic_`p' = rowtotal(nrtc_sad_resc_`p' nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p' nrtc_disturb_resc_`p' nrtc_relax_resc_`p' nrtc_bother_resc_`p'), m
				la var neurotic_`p' "Neurotism Index (0-22) Additive index of 8 questions"

		* Create second version with low and high emphasis components
			egen neurotic_g1_`p' = rowtotal(nrtc_sad_resc_`p' nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p' nrtc_disturb_resc_`p' nrtc_bother_resc_`p'), m
				la var neurotic_g1_`p' "Neuroticism index, emphasis greater than 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen neurotic_le1_`p' = rowtotal(nrtc_relax_resc_`p'), m
				la var neurotic_le1_`p' "Neuroticism index, emphasis greater than 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen neurotic_g15_`p' = rowtotal(nrtc_worry_resc_`p' nrtc_threaten_resc_`p' nrtc_disturb_resc_`p' nrtc_bother_resc_`p'), m
				la var neurotic_g15_`p' "Neuroticism index, emphasis greater than 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen neurotic_le15_`p' = rowtotal(nrtc_sad_resc_`p' nrtc_relax_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p'), m
				la var neurotic_le15_`p' "Neuroticism index, emphasis greater than 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen neurotic_g2_`p' = rowtotal(nrtc_bother_resc_`p'), m
				la var neurotic_g2_`p' "Neuroticism index, emphasis greater than 2" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen neurotic_le2_`p' = rowtotal(nrtc_disturb_resc_`p' nrtc_threaten_resc_`p' nrtc_worry_resc_`p' nrtc_sad_resc_`p' nrtc_relax_resc_`p' nrtc_offend_resc_`p' nrtc_stress_resc_`p'), m
				la var neurotic_le2_`p' "Neuroticism index, emphasis greater than 2" /// See "variable construction/CBT Training Emphasis.xlsx"

		}

	// Locus of Control

		foreach p in b e {

		* Variables
			summ lc_choicesfuture_`p' lc_nocontrol_`p' lc_bizluck_`p' lc_tryhard_`p' lc_planswork_`p' lc_badluck_`p' lc_peoplestreets_`p' lc_success_`p'

		* Positive questions: Change to 0-Really Disagree 1-Disagree 2-Agree 3-Really Agree
			foreach var in lc_choicesfuture lc_tryhard lc_planswork lc_success {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'*-1+4
				la var `var'_resc_`p' "`lab' (Rescaled)"
			}

		* Negative question : Change to 0-Really Agree 1-Agree 2-Disagree 3-Really Disagree
			foreach var in  lc_nocontrol lc_bizluck lc_badluck lc_peoplestreets {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'-1
				la var `var'_resc_`p' "`lab'"
			}


		* Analyze responses
			summ lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_bizluck_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_badluck_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'
			pwcorr lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_bizluck_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_badluck_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'
			factor lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_bizluck_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_badluck_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'

		* Generate locus of control index
			egen locuscontr_`p' = rowtotal(lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_bizluck_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_badluck_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'), m
				la var locuscontr_`p' "Locus of Control Index (0-24) add index of 8 questions"

		* Create second version with low and high emphasis components
			egen locuscontr_g1_`p' = rowtotal(lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_bizluck_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'), m
				la var locuscontr_g1_`p' "Locus of control index, emphasis greater than 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen locuscontr_le1_`p' = rowtotal(lc_badluck_resc_`p'), m
				la var locuscontr_le1_`p' "Locus of control index, emphasis less than or equal to 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen locuscontr_g15_`p' = rowtotal(lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_peoplestreets_resc_`p' lc_success_resc_`p'), m
				la var locuscontr_g15_`p' "Locus of control index, emphasis greater than 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen locuscontr_le15_`p' = rowtotal(lc_badluck_resc_`p' lc_bizluck_resc_`p'), m
				la var locuscontr_le15_`p' "Locus of control index, emphasis less than or equal to 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen locuscontr_g2_`p' = rowtotal(lc_choicesfuture_resc_`p' lc_nocontrol_resc_`p' lc_tryhard_resc_`p' lc_planswork_resc_`p' lc_success_resc_`p'), m
				la var locuscontr_g2_`p' "Locus of control index, emphasis greater than 2" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen locuscontr_le2_`p' = rowtotal(lc_badluck_resc_`p' lc_bizluck_resc_`p' lc_peoplestreets_resc_`p'), m
				la var locuscontr_le2_`p' "Locus of control index, emphasis less than or equal to 2" /// See "variable construction/CBT Training Emphasis.xlsx"

		}

	// Self Esteem

	foreach p in b e {

		* Variables
			summ se_satisfied_`p'  se_useless_`p' se_fail_`p' se_respect_`p' se_goodperson_`p' se_good4nothing_`p' se_bizwell_`p' se_notproud_`p'

		* Positive questions: Change to 0-Really Disagree 1-Disagree 2-Agree 3-Really Agree
			foreach var in se_satisfied se_goodperson se_good4nothing se_bizwell  {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'*-1+4
				la var `var'_resc_`p' "`lab' (Rescaled)"
			}

		* Negative question : Change to 0-Really Agree 1-Agree 2-Disagree 3-Really Disagree
			foreach var in  se_useless se_fail se_respect se_notproud  {
				local lab: var lab `var'_`p'
				gen `var'_resc_`p' = `var'_`p'-1
				la var `var'_resc_`p' "`lab'"
			}

		* Analyze responses
			summ se_satisfied_resc_`p'  se_useless_resc_`p' se_fail_resc_`p' se_respect_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'
			pwcorr se_satisfied_resc_`p'  se_useless_resc_`p' se_fail_resc_`p' se_respect_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'
			factor se_satisfied_resc_`p'  se_useless_resc_`p' se_fail_resc_`p' se_respect_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'

		* Generate self esteem index
			egen selfesteem_`p' = rowtotal(se_satisfied_resc_`p'  se_useless_resc_`p' se_fail_resc_`p' se_respect_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'), m
				la var selfesteem_`p' "Self Esteem Index (0-24) add index of 8 questions"

		* Create second version with low and high emphasis components
			egen selfesteem_g1_`p' = rowtotal(se_satisfied_resc_`p'  se_useless_resc_`p' se_fail_resc_`p' se_respect_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'), m
				la var selfesteem_g1_`p' "Self esteem index, emphasis greater than 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			gen selfesteem_le1_`p' = .
				la var selfesteem_le1_`p' "Self esteem index, emphasis less than or equal to 1" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen selfesteem_g15_`p' = rowtotal(se_satisfied_resc_`p'  se_useless_resc_`p' se_respect_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p' se_notproud_resc_`p'), m
				la var selfesteem_g15_`p' "Self esteem index, emphasis greater than 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen selfesteem_le15_`p' = rowtotal(se_fail_resc_`p' se_goodperson_resc_`p'), m
				la var selfesteem_le15_`p' "Self esteem index, emphasis less than or equal to 1.5" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen selfesteem_g2_`p' = rowtotal(se_useless_resc_`p' se_respect_resc_`p' se_notproud_resc_`p'), m
				la var selfesteem_g2_`p' "Self esteem index, emphasis greater than 2" /// See "variable construction/CBT Training Emphasis.xlsx"

			egen selfesteem_le2_`p' = rowtotal(se_satisfied_resc_`p' se_fail_resc_`p' se_goodperson_resc_`p' se_good4nothing_resc_`p' se_bizwell_resc_`p'), m
				la var selfesteem_le2_`p' "Self esteem index, emphasis less than or equal to 2" /// See "variable construction/CBT Training Emphasis.xlsx"

		}




		/* Construct Aggregate Measure */
		foreach p in b e {
			/* Standardize personality measures */
				foreach x in impulsive neurotic rewardresp locuscontr selfesteem conscientious grit {
					local lbl : variable label `x'_`p'
					if "`p'" == "b" {
						sum `x'_`p'
						gen `x'std_`p' = (`x'_`p'-r(mean))/r(sd)
					}
					if "`p'" == "e" {
						sum `x'_`p' if round==1
						gen `x'std_`p' = (`x'_`p'-r(mean))/r(sd) if round==1
						sum `x'_`p' if round==5 | round==6
						replace `x'std_`p' = (`x'_`p'-r(mean))/r(sd) if round==5
						sum `x'_`p' if round==7 | round==8
						replace `x'std_`p' = (`x'_`p'-r(mean))/r(sd) if round==7 | round==8
					}

					replace `x'std_`p'=. if `x'_`p'==.
					la var `x'std_`p' "`lbl' (Z-Score)"

				}
			/* Rescale personality measures that are negative */
				foreach x in impulsive neurotic rewardresp {
					gen `x'std_resc_`p' = -`x'std_`p'
					la var `x'std_resc_`p' "Rescaled: `: var lab `x'std_`p''"
				}
			egen personalitystd_`p' = rowmean(impulsivestd_resc_`p' rewardrespstd_resc_`p' conscientiousstd_`p' gritstd_`p')
				if "`p'" == "b" {
					qui sum personalitystd_`p'
					qui replace personalitystd_`p' = (personalitystd_`p'-r(mean))/r(sd)
				}
				if "`p'" == "e" {
					qui sum personalitystd_`p' if round==1
					qui replace personalitystd_`p' = (personalitystd_`p'-r(mean))/r(sd) if round==1
					qui sum personalitystd_`p' if round==5
					qui replace personalitystd_`p' = (personalitystd_`p'-r(mean))/r(sd) if round==5
				    qui sum personalitystd_`p' if round==7
					qui replace personalitystd_`p' = (personalitystd_`p'-r(mean))/r(sd) if round==7
				}


				la var personalitystd_`p' "Standardized Index of Personality Measures"
		}


		/*
		/* Construct aggregate measure with only high/low emphasis */
		foreach z in g1 g15 g2 le1 le15 le2 {
			/* Standardize personality measures */
				foreach x in impulsive  rewardresp conscientious grit {
					local lbl : variable label `x'_`z'_e
					egen `x'std`z'_e = std(`x'_`z'_e)
					replace `x'std`z'_e=. if `x'_`z'_e==.
					la var `x'std`z'_e "`lbl' (Z-Score)"

				}
			/* Rescale personality measures that are negative */
				foreach x in impulsive rewardresp {
					gen `x'std`z'_resc_e = -`x'std`z'_e
					la var `x'std`z'_resc_e "Rescaled: `: var lab `x'std`z'_e'"
				}
			egen personalitystd`z'_e = rowmean(impulsivestd`z'_resc_e rewardrespstd`z'_resc_e conscientiousstd`z'_e gritstd`z'_e)
				sum personalitystd`z'_e
				qui replace personalitystd`z'_e = (personalitystd`z'_e-r(mean))/r(sd)
				la var personalitystd`z'_e "Standardized Index of Personality Measures (restricted emphasis - `z')"

		}
